
class Student
{
    private String name;
    private int age;
    public static String classRoom="107";//通过类名进行调用

    private void eat()
    {
        System.out.println("吃饭！");
    }


    public Student(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }

    public void print()
    {
        System.out.println(name+" "+age);
    }

    {
        System.out.println("代码块");
    }
}
public class Test {

    public static void main(String[] args) {
        Student per=new Student("zhangsan",20);
        //Student per1=new Student("zhangsan",20);
        //per1.print();
        System.out.println(Student.classRoom);//通过类名进行调用
        per.setName("lisi");
        per.setAge(19);
        System.out.println(per.toString());
        //per.print();
    }
}
